{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 5,
   "outputs": [
    {
     "data": {
      "text/plain": "'\\nraw data `.mat` -> `train.mat` 和 `test.mat`\\n'"
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"\"\"\n",
    "用留一法（leave-one-out）处理mat类型的原始数据集，训练集只有正样本，测试集包括每个用户的1个正样本和99个负样本。\n",
    "raw data `.mat` -> `train.mat` 和 `test.mat`\n",
    "\"\"\""
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "outputs": [],
   "source": [
    "import os\n",
    "from tqdm import tqdm\n",
    "import scipy.io as spio\n",
    "from scipy.sparse import csr_matrix\n",
    "import numpy as np\n",
    "import random\n",
    "\n",
    "seed = 2022\n",
    "\n",
    "random.seed(seed)\n",
    "np.random.seed(seed)\n",
    "dataset_name = \"gowalla\"\n",
    "raw_data_path = \"/data/tshuang/Projects/sauc_sample/datasets/raw_datasets/\"\n",
    "target_data_path = \"/data/tshuang/Projects/sauc_sample/datasets/target_datasets/\""
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "outputs": [
    {
     "data": {
      "text/plain": "<29858x40988 sparse matrix of type '<class 'numpy.float64'>'\n\twith 1027464 stored elements in Compressed Sparse Column format>"
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mat = spio.loadmat(os.path.join(raw_data_path, dataset_name + \"data.mat\"))['data']\n",
    "mat"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "# 交互数据的划分"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [
    "# 按比例划分\n",
    "\n",
    "# def split_test_matrix(mat, ratio=0.8):\n",
    "#     mat = mat.tocsr()  #按行读取，即每一行为一个用户\n",
    "#     m,n = mat.shape\n",
    "#     train_data_indices = []\n",
    "#     train_indptr = [0] * (m+1)\n",
    "#     test_data_indices = []\n",
    "#     test_indptr = [0] * (m+1)\n",
    "#     with tqdm(range(m)) as temp:\n",
    "#         for i in temp:\n",
    "#             row = [(mat.indices[j], mat.data[j]) for j in range(mat.indptr[i], mat.indptr[i+1])]\n",
    "#             train_idx = random.sample(range(len(row)), round(ratio * len(row)))\n",
    "#             train_binary_idx = np.full(len(row), False)\n",
    "#             train_binary_idx[train_idx] = True\n",
    "#             test_idx = (~train_binary_idx).nonzero()[0]\n",
    "#             for idx in train_idx:\n",
    "#                 train_data_indices.append(row[idx])\n",
    "#             train_indptr[i+1] = len(train_data_indices)\n",
    "#             for idx in test_idx:\n",
    "#                 test_data_indices.append(row[idx])\n",
    "#             test_indptr[i+1] = len(test_data_indices)\n",
    "#\n",
    "#     [train_indices, train_data] = zip(*train_data_indices)\n",
    "#     [test_indices, test_data] = zip(*test_data_indices)\n",
    "#\n",
    "#     train_mat = csr_matrix((train_data, train_indices, train_indptr), (m,n))\n",
    "#     test_mat = csr_matrix((test_data, test_indices, test_indptr), (m,n))\n",
    "#     # save\n",
    "#     spio.savemat(os.path.join(target_data_path, dataset_name + \"_train.mat\"), {\"train_mat\": train_mat})\n",
    "#     spio.savemat(os.path.join(target_data_path, dataset_name + \"_test.mat\"), {\"test_mat\": test_mat})\n",
    "\n",
    "# mat = spio.loadmat(os.path.join(raw_data_path, dataset_name + \"data.mat\"))['data']\n",
    "# split_test_matrix(mat, ratio=0.8)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 29858/29858 [02:51<00:00, 173.94it/s]\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0 0\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "# 留一法划分\n",
    "\n",
    "def split_test_matrix_loo(mat):\n",
    "    mat = mat.tocsr()  #按行读取，即每一行为一个用户\n",
    "    m,n = mat.shape\n",
    "    # m = 5\n",
    "    train_indices = []\n",
    "    train_indptr = [0] * (m + 1)\n",
    "    test_data = []\n",
    "    with tqdm(range(m)) as temp:\n",
    "        for u in temp:\n",
    "            u_pos_list = [(mat.indices[j]) for j in range(mat.indptr[u], mat.indptr[u+1])]\n",
    "            # u_pos_list = list(zip(u_pos_list))\n",
    "            # print(u_pos_list)\n",
    "            # 采一个正样本用于验证\n",
    "            test_idx = random.sample(range(len(u_pos_list)), 1)\n",
    "            u_test_data = [u_pos_list[test_idx[0]]]\n",
    "            for _ in range(99):  # 99个负样本\n",
    "                while True:\n",
    "                    neg_idx = random.randint(0, n-1)\n",
    "                    if neg_idx not in u_pos_list:\n",
    "                        u_test_data.append(neg_idx)\n",
    "                        break\n",
    "            test_data.append(u_test_data)\n",
    "\n",
    "            test_binary_idx = np.full(len(u_pos_list), False)\n",
    "            test_binary_idx[test_idx] = True\n",
    "            train_idx = (~test_binary_idx).nonzero()[0]  # 这一行啥意思？\n",
    "            # 拼接成csr\n",
    "            for idx in train_idx:\n",
    "                train_indices.append(u_pos_list[idx])\n",
    "            train_indptr[u + 1] = len(train_indices)\n",
    "    print(train_indices[0], train_indptr[0])\n",
    "    train_mat = csr_matrix(([1]*len(train_indices), train_indices, train_indptr), (m, n))\n",
    "    test_data = pd.DataFrame(np.array(test_data))\n",
    "    return train_mat, test_data\n",
    "\n",
    "train_mat, test_data = split_test_matrix_loo(mat)\n"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "outputs": [
    {
     "data": {
      "text/plain": "          0      1      2      3      4      5      6      7      8      9   \\\n0         49  23247  11352  29177  36827  18323   4910  21816  18118  10154   \n1        194  15925  32590   4542   7259  39748  21131  38345  28718  18858   \n2        441   3799   8874   6626  13615  24479  15519   1833  23578  28862   \n3        478  40407   4403  31401  26821  14237  38284  17992   4998  15070   \n4          2  12786  26668  15102  26355   1147   8327  32207  25605  33266   \n5        525   5853  28570  39060  34857  36620  37922  34578  15142  32642   \n6        535  40595   2369  15608  29258   9661  28372  35767  28182  20932   \n7        571  24247  28284  18591  27563  22134  38617  30806  13926  39566   \n8        636   6125  11255  34032    798  17110  14236  14118   5919  14317   \n9        654  15562  31299  22308  23741  39183  36408  10170  28952  32487   \n10        61  19439  19234  24907  31325   9197   3526  23526   1496  24017   \n11       721  18660  31702  22535  12828  20591  28749  34749  10693   4639   \n12       785  15127  13262  21637  20870  24092  12794  10121   2630  13159   \n13       863  23417   2722  13484   6537  32178  30034  25669  19258  19431   \n14      1252  23761  39570   5629   3871  17897   9547   3658   8792  33013   \n15      1514   4154  19209  36889  11125  15547  18484  34327  24586   5764   \n16        67  30171  14477  23918  29383   1711  21094   3017  40807   2816   \n17        60   7572   1944  37757  31622  30931   3869  19579  32736  10570   \n18      1620  29787  32475   6808  20584  21651   8860   7585   1799  18055   \n19       610  34430  21477   8493   5089  34920  26868  21079   9527  22834   \n20      1658  35340  35181  24292  37387  15430  15927   7446  35040  38937   \n21      1732  12473  27889  25200  34514   1563  40409  33934  22811    239   \n22      1786   9631  22158  15083  29787  27784  32799  21849   3739  25312   \n23      1830  20867  28618   4576  37905  24788   4583  15685   8453   9732   \n24      2040  14601  21042   4433  18227  37080  11122  11464  31284  32122   \n25      2050  11351  12384  32492  29189   4188  23682  20114  33489   2685   \n26      2201  33729  20709   6182  11623  33780  31765  22835  12265  30355   \n27      2222  23815  38339  27309  30020  31174  35730  35057  19810  10510   \n28         9  22859  35044   4627   9125  19123  34735  34622  31127  31910   \n29       654  14069  31462   2210  27827   8289   1472  15549  35240  34418   \n...      ...    ...    ...    ...    ...    ...    ...    ...    ...    ...   \n29828  25821  23715  23164  15220  38818  17232  23238  27609   1023  28887   \n29829   4315  15087  30482  39796  30134  36508  35952  25374   9543  35490   \n29830  31553  35060  31961  18120  20739  27132  38627  23108  18451  28046   \n29831  34484  40804  34073  36606  24265  25461  37151  21321  22613   9060   \n29832  14290  23508  11206   2383  29674   2308  27154  16181  39864  18533   \n29833  38368  39175   7875  12613  23332  38676   3578  40525    886  40090   \n29834  21873  31124  26819  36443  30392  22079  10622  14433   5108   9918   \n29835   3121  23308  34837   7076   3443    430  38704  12984   8524   6998   \n29836  37483  15036   1215  35062  13899  27704   6835  29500  29448  30397   \n29837   8555  27998  33376  34965  38471  24699   7176  17960  24760  38891   \n29838  36129  22248   2040  35857  33743  10412  28886  13858   7037  31387   \n29839  38445  29462  31951  39360  25166  38663   5368  39587  30991  28800   \n29840  23774  39116  20038  27161  23483   4034  12550  22538   7223  40544   \n29841  36098  13662   5105    753  25783   5250  33205  14031  21772   6522   \n29842  35232  33734  33768  17879   9840  11482  14925  18851  20119   3991   \n29843  18683  10228  32577  36172   2318  28429   9620   3099  16743   7007   \n29844   6690  19844  35546  20677  17458  19702  19852  33103  15970  16027   \n29845  20604  24669  29722  18484  29403  34652   7868  22588   9828  34001   \n29846   2298    565  16589     51  32058   5165  34547   2618  21370  38871   \n29847   9400  25360  39811  32234  11474  22463  27138  36875  10265   8097   \n29848  39744  34500   9044  11187   6462   6681   7090  20023  36458  24541   \n29849   5741   2680  13419  29824   5832  37564  22952   2670   8851   3844   \n29850  18529  32783  40852  33559   1501  11705  28961  32524  22550   9919   \n29851   8049  20920   3483   1645  23600  11341  29504  34876  35807   4809   \n29852   1132  36838  24664  30827  36991  14290  35265   9707  26246  20654   \n29853  35209    443  32953  19655  18922  34601  31331  26159  20057  13618   \n29854  14287  25957  11688  28348  25774  23947  25904  17430  30902   7618   \n29855  38168   6004  20972  38886  34281  24360  33896  38994   1390  17697   \n29856  33902  40154  25829  27537   8644   8629  10302  35634  17692   6492   \n29857  26216  22928  13830  28456  32645  21903  38645  34268  29082  34166   \n\n       ...     90     91     92     93     94     95     96     97     98  \\\n0      ...  36727  40330  38182  27156  17917  18237  30801   1462  31237   \n1      ...  15551  20990  31306  30091  34239  27907  24640  27222  33237   \n2      ...   7326  10220  11250  15648  38364  27907   7177  26015  23115   \n3      ...   7932  22502  31252    764   7706  28712  11627  14652  37542   \n4      ...   9135  27307   7591  31698  11589   4801  22353  30466  23478   \n5      ...  13765  26399   8049  34326  34129   9529  33725  36587  28249   \n6      ...  38627  34955   6620   7044  18972   3730  20298  10147  33356   \n7      ...   8319  29992  29194  23039   5364  25939   9300  21500  38576   \n8      ...   2050  21761   8267  37620  18128   6290   4948   6919  34157   \n9      ...   9315  27654  11405  21906   2399  13396  33967   6403  16217   \n10     ...  16024  14475  26917  33603    986  13011  17497   6454  38901   \n11     ...  34364  18500  19656  37857   5421  10958  15253  11883   3409   \n12     ...   4987  11745  25447   4042  25457  22135  25553  14421  32351   \n13     ...  32080  22460  22125   9971  19103  21124  25146  12451  25905   \n14     ...  21641  12086  26788  36042   9321  31469  16886  33022  36806   \n15     ...  40834   6762  39770  25665   2504  27341  35893  12497  20040   \n16     ...   4044  19242  22523  31213   7395  37102  35517  36602  16434   \n17     ...  26887    456  12991  13895  14227  38572  29330  36068  12627   \n18     ...  13358  28854  19967  12580  20457  27476   5170  14144  15998   \n19     ...  31127  21539   2827  38312  35987  29247  12344  10088  30463   \n20     ...  31541  35446  18096  10923  25210   1930   4562  23941  11082   \n21     ...  23420  25572  10278  19466  35506  18192  23210   7045  25528   \n22     ...   1190  33666  31647   3343  14018  11340  40561  17393  20156   \n23     ...  25891   8906  20163  17853  31355  37759  13824  13411  30068   \n24     ...  30630  24548  32717  11703  31410  27040  35982   3152  18227   \n25     ...   2761   5902   4741  35852  13579   4221   7761  40409  26241   \n26     ...  28770   9492  23182  28434  39543    194  36397  12964  16574   \n27     ...  27290  23905  11245   6430   6514  18320  34374   9252   6737   \n28     ...  14507  20869   3036  15560  14470  30790  15428  27746   5743   \n29     ...  12810  20898  40411  29804  40351  37094  38787   9968  17350   \n...    ...    ...    ...    ...    ...    ...    ...    ...    ...    ...   \n29828  ...   4534  40860  15170  13083   6305  25038  21937  33333  28694   \n29829  ...  36425  16929  35910  25285  38467  12836  35844    407  14474   \n29830  ...  25951  24318  26025  35596   6668  12737  34117   6603  23803   \n29831  ...  19804  14787   4239  18279  31815  14965  36462  29628  12789   \n29832  ...  29493  31172   5241  11294     45  16862    279   4508  32708   \n29833  ...  29828   8446    184  27384  24588   2664  34223  24302  25994   \n29834  ...   9256  12120   3573  33951   2426  22915  12335  34479  36128   \n29835  ...   6602  40945   9610  16230  27134   9907    156  22975  24111   \n29836  ...  16461  20672  35555  40956   5068   7842  12096  15479  20233   \n29837  ...  22280   4040  24660   5561  14475  23448    446  40173  28438   \n29838  ...  36863   8421  20008  37275   8932  32247  21752  20650  30744   \n29839  ...   5497  37284    470  15505  32238  16766  37461  36303  22101   \n29840  ...  32759  28933  24065   6633  17351  17485  21959   8886  26012   \n29841  ...  33563   5288  27705   5390   2363  38478   6251  11134  18361   \n29842  ...   5972   5081  32307   3424  18588  28895  18017  14345  29054   \n29843  ...  15783   5743   6642  36061  14483  19144  38002  14011  19080   \n29844  ...  19069   7001  15831  20101   6894  36439  11563  23378  10430   \n29845  ...  40413  20636   8114  27760   5010   3593   9889  20393  13664   \n29846  ...  11459   4302    407  18301  37672  36783    555  12707  12219   \n29847  ...   7699   3102  40066  28917  32842  24404  11421  29214  37257   \n29848  ...  28041  39447  20752  33542  12035  28356  19288   4370  19682   \n29849  ...  24195  33360  11682  29587  18753  30031  19408  12522  26335   \n29850  ...  38279  12050  21439  13947  30676   3690  33283  25691  10788   \n29851  ...  20096   5196   9800  20110  11489  19020  12623    351  31987   \n29852  ...  23452  17052  17261  11179  33339  26310  16164  33902  18603   \n29853  ...  28154  25344  27679  22958  29303  34478  25289  32604  12938   \n29854  ...   7359  11699  22992   5816  19070  15396  35054  23274  24481   \n29855  ...  15706  20215  29519  26502  34223  40478  10363  20292  30349   \n29856  ...  34436  35606  15900  14162  16570  39577  40077  18069  35831   \n29857  ...  18180  22897  28221  29488  39285   7932  16461  12189  29134   \n\n          99  \n0      15142  \n1      25675  \n2       3190  \n3      13377  \n4      29530  \n5      31770  \n6      35531  \n7      17735  \n8      32133  \n9      24607  \n10     36483  \n11     16542  \n12     20473  \n13      2966  \n14     35146  \n15     10618  \n16      4124  \n17     27350  \n18     24227  \n19     34438  \n20     28371  \n21     14440  \n22     29789  \n23     19059  \n24      2746  \n25     23497  \n26     11744  \n27     29045  \n28     33981  \n29     14441  \n...      ...  \n29828   8082  \n29829  32608  \n29830  10130  \n29831  27680  \n29832  29290  \n29833  20992  \n29834  32547  \n29835   4550  \n29836  10956  \n29837   7237  \n29838  36204  \n29839   5813  \n29840  12965  \n29841  13887  \n29842   3799  \n29843  11825  \n29844   1220  \n29845  32336  \n29846  11613  \n29847  18229  \n29848  32779  \n29849  25458  \n29850  10172  \n29851  32006  \n29852  21995  \n29853  11782  \n29854   1510  \n29855  25698  \n29856  15471  \n29857   7871  \n\n[29858 rows x 100 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>0</th>\n      <th>1</th>\n      <th>2</th>\n      <th>3</th>\n      <th>4</th>\n      <th>5</th>\n      <th>6</th>\n      <th>7</th>\n      <th>8</th>\n      <th>9</th>\n      <th>...</th>\n      <th>90</th>\n      <th>91</th>\n      <th>92</th>\n      <th>93</th>\n      <th>94</th>\n      <th>95</th>\n      <th>96</th>\n      <th>97</th>\n      <th>98</th>\n      <th>99</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>49</td>\n      <td>23247</td>\n      <td>11352</td>\n      <td>29177</td>\n      <td>36827</td>\n      <td>18323</td>\n      <td>4910</td>\n      <td>21816</td>\n      <td>18118</td>\n      <td>10154</td>\n      <td>...</td>\n      <td>36727</td>\n      <td>40330</td>\n      <td>38182</td>\n      <td>27156</td>\n      <td>17917</td>\n      <td>18237</td>\n      <td>30801</td>\n      <td>1462</td>\n      <td>31237</td>\n      <td>15142</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>194</td>\n      <td>15925</td>\n      <td>32590</td>\n      <td>4542</td>\n      <td>7259</td>\n      <td>39748</td>\n      <td>21131</td>\n      <td>38345</td>\n      <td>28718</td>\n      <td>18858</td>\n      <td>...</td>\n      <td>15551</td>\n      <td>20990</td>\n      <td>31306</td>\n      <td>30091</td>\n      <td>34239</td>\n      <td>27907</td>\n      <td>24640</td>\n      <td>27222</td>\n      <td>33237</td>\n      <td>25675</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>441</td>\n      <td>3799</td>\n      <td>8874</td>\n      <td>6626</td>\n      <td>13615</td>\n      <td>24479</td>\n      <td>15519</td>\n      <td>1833</td>\n      <td>23578</td>\n      <td>28862</td>\n      <td>...</td>\n      <td>7326</td>\n      <td>10220</td>\n      <td>11250</td>\n      <td>15648</td>\n      <td>38364</td>\n      <td>27907</td>\n      <td>7177</td>\n      <td>26015</td>\n      <td>23115</td>\n      <td>3190</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>478</td>\n      <td>40407</td>\n      <td>4403</td>\n      <td>31401</td>\n      <td>26821</td>\n      <td>14237</td>\n      <td>38284</td>\n      <td>17992</td>\n      <td>4998</td>\n      <td>15070</td>\n      <td>...</td>\n      <td>7932</td>\n      <td>22502</td>\n      <td>31252</td>\n      <td>764</td>\n      <td>7706</td>\n      <td>28712</td>\n      <td>11627</td>\n      <td>14652</td>\n      <td>37542</td>\n      <td>13377</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>2</td>\n      <td>12786</td>\n      <td>26668</td>\n      <td>15102</td>\n      <td>26355</td>\n      <td>1147</td>\n      <td>8327</td>\n      <td>32207</td>\n      <td>25605</td>\n      <td>33266</td>\n      <td>...</td>\n      <td>9135</td>\n      <td>27307</td>\n      <td>7591</td>\n      <td>31698</td>\n      <td>11589</td>\n      <td>4801</td>\n      <td>22353</td>\n      <td>30466</td>\n      <td>23478</td>\n      <td>29530</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>525</td>\n      <td>5853</td>\n      <td>28570</td>\n      <td>39060</td>\n      <td>34857</td>\n      <td>36620</td>\n      <td>37922</td>\n      <td>34578</td>\n      <td>15142</td>\n      <td>32642</td>\n      <td>...</td>\n      <td>13765</td>\n      <td>26399</td>\n      <td>8049</td>\n      <td>34326</td>\n      <td>34129</td>\n      <td>9529</td>\n      <td>33725</td>\n      <td>36587</td>\n      <td>28249</td>\n      <td>31770</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>535</td>\n      <td>40595</td>\n      <td>2369</td>\n      <td>15608</td>\n      <td>29258</td>\n      <td>9661</td>\n      <td>28372</td>\n      <td>35767</td>\n      <td>28182</td>\n      <td>20932</td>\n      <td>...</td>\n      <td>38627</td>\n      <td>34955</td>\n      <td>6620</td>\n      <td>7044</td>\n      <td>18972</td>\n      <td>3730</td>\n      <td>20298</td>\n      <td>10147</td>\n      <td>33356</td>\n      <td>35531</td>\n    </tr>\n    <tr>\n      <th>7</th>\n      <td>571</td>\n      <td>24247</td>\n      <td>28284</td>\n      <td>18591</td>\n      <td>27563</td>\n      <td>22134</td>\n      <td>38617</td>\n      <td>30806</td>\n      <td>13926</td>\n      <td>39566</td>\n      <td>...</td>\n      <td>8319</td>\n      <td>29992</td>\n      <td>29194</td>\n      <td>23039</td>\n      <td>5364</td>\n      <td>25939</td>\n      <td>9300</td>\n      <td>21500</td>\n      <td>38576</td>\n      <td>17735</td>\n    </tr>\n    <tr>\n      <th>8</th>\n      <td>636</td>\n      <td>6125</td>\n      <td>11255</td>\n      <td>34032</td>\n      <td>798</td>\n      <td>17110</td>\n      <td>14236</td>\n      <td>14118</td>\n      <td>5919</td>\n      <td>14317</td>\n      <td>...</td>\n      <td>2050</td>\n      <td>21761</td>\n      <td>8267</td>\n      <td>37620</td>\n      <td>18128</td>\n      <td>6290</td>\n      <td>4948</td>\n      <td>6919</td>\n      <td>34157</td>\n      <td>32133</td>\n    </tr>\n    <tr>\n      <th>9</th>\n      <td>654</td>\n      <td>15562</td>\n      <td>31299</td>\n      <td>22308</td>\n      <td>23741</td>\n      <td>39183</td>\n      <td>36408</td>\n      <td>10170</td>\n      <td>28952</td>\n      <td>32487</td>\n      <td>...</td>\n      <td>9315</td>\n      <td>27654</td>\n      <td>11405</td>\n      <td>21906</td>\n      <td>2399</td>\n      <td>13396</td>\n      <td>33967</td>\n      <td>6403</td>\n      <td>16217</td>\n      <td>24607</td>\n    </tr>\n    <tr>\n      <th>10</th>\n      <td>61</td>\n      <td>19439</td>\n      <td>19234</td>\n      <td>24907</td>\n      <td>31325</td>\n      <td>9197</td>\n      <td>3526</td>\n      <td>23526</td>\n      <td>1496</td>\n      <td>24017</td>\n      <td>...</td>\n      <td>16024</td>\n      <td>14475</td>\n      <td>26917</td>\n      <td>33603</td>\n      <td>986</td>\n      <td>13011</td>\n      <td>17497</td>\n      <td>6454</td>\n      <td>38901</td>\n      <td>36483</td>\n    </tr>\n    <tr>\n      <th>11</th>\n      <td>721</td>\n      <td>18660</td>\n      <td>31702</td>\n      <td>22535</td>\n      <td>12828</td>\n      <td>20591</td>\n      <td>28749</td>\n      <td>34749</td>\n      <td>10693</td>\n      <td>4639</td>\n      <td>...</td>\n      <td>34364</td>\n      <td>18500</td>\n      <td>19656</td>\n      <td>37857</td>\n      <td>5421</td>\n      <td>10958</td>\n      <td>15253</td>\n      <td>11883</td>\n      <td>3409</td>\n      <td>16542</td>\n    </tr>\n    <tr>\n      <th>12</th>\n      <td>785</td>\n      <td>15127</td>\n      <td>13262</td>\n      <td>21637</td>\n      <td>20870</td>\n      <td>24092</td>\n      <td>12794</td>\n      <td>10121</td>\n      <td>2630</td>\n      <td>13159</td>\n      <td>...</td>\n      <td>4987</td>\n      <td>11745</td>\n      <td>25447</td>\n      <td>4042</td>\n      <td>25457</td>\n      <td>22135</td>\n      <td>25553</td>\n      <td>14421</td>\n      <td>32351</td>\n      <td>20473</td>\n    </tr>\n    <tr>\n      <th>13</th>\n      <td>863</td>\n      <td>23417</td>\n      <td>2722</td>\n      <td>13484</td>\n      <td>6537</td>\n      <td>32178</td>\n      <td>30034</td>\n      <td>25669</td>\n      <td>19258</td>\n      <td>19431</td>\n      <td>...</td>\n      <td>32080</td>\n      <td>22460</td>\n      <td>22125</td>\n      <td>9971</td>\n      <td>19103</td>\n      <td>21124</td>\n      <td>25146</td>\n      <td>12451</td>\n      <td>25905</td>\n      <td>2966</td>\n    </tr>\n    <tr>\n      <th>14</th>\n      <td>1252</td>\n      <td>23761</td>\n      <td>39570</td>\n      <td>5629</td>\n      <td>3871</td>\n      <td>17897</td>\n      <td>9547</td>\n      <td>3658</td>\n      <td>8792</td>\n      <td>33013</td>\n      <td>...</td>\n      <td>21641</td>\n      <td>12086</td>\n      <td>26788</td>\n      <td>36042</td>\n      <td>9321</td>\n      <td>31469</td>\n      <td>16886</td>\n      <td>33022</td>\n      <td>36806</td>\n      <td>35146</td>\n    </tr>\n    <tr>\n      <th>15</th>\n      <td>1514</td>\n      <td>4154</td>\n      <td>19209</td>\n      <td>36889</td>\n      <td>11125</td>\n      <td>15547</td>\n      <td>18484</td>\n      <td>34327</td>\n      <td>24586</td>\n      <td>5764</td>\n      <td>...</td>\n      <td>40834</td>\n      <td>6762</td>\n      <td>39770</td>\n      <td>25665</td>\n      <td>2504</td>\n      <td>27341</td>\n      <td>35893</td>\n      <td>12497</td>\n      <td>20040</td>\n      <td>10618</td>\n    </tr>\n    <tr>\n      <th>16</th>\n      <td>67</td>\n      <td>30171</td>\n      <td>14477</td>\n      <td>23918</td>\n      <td>29383</td>\n      <td>1711</td>\n      <td>21094</td>\n      <td>3017</td>\n      <td>40807</td>\n      <td>2816</td>\n      <td>...</td>\n      <td>4044</td>\n      <td>19242</td>\n      <td>22523</td>\n      <td>31213</td>\n      <td>7395</td>\n      <td>37102</td>\n      <td>35517</td>\n      <td>36602</td>\n      <td>16434</td>\n      <td>4124</td>\n    </tr>\n    <tr>\n      <th>17</th>\n      <td>60</td>\n      <td>7572</td>\n      <td>1944</td>\n      <td>37757</td>\n      <td>31622</td>\n      <td>30931</td>\n      <td>3869</td>\n      <td>19579</td>\n      <td>32736</td>\n      <td>10570</td>\n      <td>...</td>\n      <td>26887</td>\n      <td>456</td>\n      <td>12991</td>\n      <td>13895</td>\n      <td>14227</td>\n      <td>38572</td>\n      <td>29330</td>\n      <td>36068</td>\n      <td>12627</td>\n      <td>27350</td>\n    </tr>\n    <tr>\n      <th>18</th>\n      <td>1620</td>\n      <td>29787</td>\n      <td>32475</td>\n      <td>6808</td>\n      <td>20584</td>\n      <td>21651</td>\n      <td>8860</td>\n      <td>7585</td>\n      <td>1799</td>\n      <td>18055</td>\n      <td>...</td>\n      <td>13358</td>\n      <td>28854</td>\n      <td>19967</td>\n      <td>12580</td>\n      <td>20457</td>\n      <td>27476</td>\n      <td>5170</td>\n      <td>14144</td>\n      <td>15998</td>\n      <td>24227</td>\n    </tr>\n    <tr>\n      <th>19</th>\n      <td>610</td>\n      <td>34430</td>\n      <td>21477</td>\n      <td>8493</td>\n      <td>5089</td>\n      <td>34920</td>\n      <td>26868</td>\n      <td>21079</td>\n      <td>9527</td>\n      <td>22834</td>\n      <td>...</td>\n      <td>31127</td>\n      <td>21539</td>\n      <td>2827</td>\n      <td>38312</td>\n      <td>35987</td>\n      <td>29247</td>\n      <td>12344</td>\n      <td>10088</td>\n      <td>30463</td>\n      <td>34438</td>\n    </tr>\n    <tr>\n      <th>20</th>\n      <td>1658</td>\n      <td>35340</td>\n      <td>35181</td>\n      <td>24292</td>\n      <td>37387</td>\n      <td>15430</td>\n      <td>15927</td>\n      <td>7446</td>\n      <td>35040</td>\n      <td>38937</td>\n      <td>...</td>\n      <td>31541</td>\n      <td>35446</td>\n      <td>18096</td>\n      <td>10923</td>\n      <td>25210</td>\n      <td>1930</td>\n      <td>4562</td>\n      <td>23941</td>\n      <td>11082</td>\n      <td>28371</td>\n    </tr>\n    <tr>\n      <th>21</th>\n      <td>1732</td>\n      <td>12473</td>\n      <td>27889</td>\n      <td>25200</td>\n      <td>34514</td>\n      <td>1563</td>\n      <td>40409</td>\n      <td>33934</td>\n      <td>22811</td>\n      <td>239</td>\n      <td>...</td>\n      <td>23420</td>\n      <td>25572</td>\n      <td>10278</td>\n      <td>19466</td>\n      <td>35506</td>\n      <td>18192</td>\n      <td>23210</td>\n      <td>7045</td>\n      <td>25528</td>\n      <td>14440</td>\n    </tr>\n    <tr>\n      <th>22</th>\n      <td>1786</td>\n      <td>9631</td>\n      <td>22158</td>\n      <td>15083</td>\n      <td>29787</td>\n      <td>27784</td>\n      <td>32799</td>\n      <td>21849</td>\n      <td>3739</td>\n      <td>25312</td>\n      <td>...</td>\n      <td>1190</td>\n      <td>33666</td>\n      <td>31647</td>\n      <td>3343</td>\n      <td>14018</td>\n      <td>11340</td>\n      <td>40561</td>\n      <td>17393</td>\n      <td>20156</td>\n      <td>29789</td>\n    </tr>\n    <tr>\n      <th>23</th>\n      <td>1830</td>\n      <td>20867</td>\n      <td>28618</td>\n      <td>4576</td>\n      <td>37905</td>\n      <td>24788</td>\n      <td>4583</td>\n      <td>15685</td>\n      <td>8453</td>\n      <td>9732</td>\n      <td>...</td>\n      <td>25891</td>\n      <td>8906</td>\n      <td>20163</td>\n      <td>17853</td>\n      <td>31355</td>\n      <td>37759</td>\n      <td>13824</td>\n      <td>13411</td>\n      <td>30068</td>\n      <td>19059</td>\n    </tr>\n    <tr>\n      <th>24</th>\n      <td>2040</td>\n      <td>14601</td>\n      <td>21042</td>\n      <td>4433</td>\n      <td>18227</td>\n      <td>37080</td>\n      <td>11122</td>\n      <td>11464</td>\n      <td>31284</td>\n      <td>32122</td>\n      <td>...</td>\n      <td>30630</td>\n      <td>24548</td>\n      <td>32717</td>\n      <td>11703</td>\n      <td>31410</td>\n      <td>27040</td>\n      <td>35982</td>\n      <td>3152</td>\n      <td>18227</td>\n      <td>2746</td>\n    </tr>\n    <tr>\n      <th>25</th>\n      <td>2050</td>\n      <td>11351</td>\n      <td>12384</td>\n      <td>32492</td>\n      <td>29189</td>\n      <td>4188</td>\n      <td>23682</td>\n      <td>20114</td>\n      <td>33489</td>\n      <td>2685</td>\n      <td>...</td>\n      <td>2761</td>\n      <td>5902</td>\n      <td>4741</td>\n      <td>35852</td>\n      <td>13579</td>\n      <td>4221</td>\n      <td>7761</td>\n      <td>40409</td>\n      <td>26241</td>\n      <td>23497</td>\n    </tr>\n    <tr>\n      <th>26</th>\n      <td>2201</td>\n      <td>33729</td>\n      <td>20709</td>\n      <td>6182</td>\n      <td>11623</td>\n      <td>33780</td>\n      <td>31765</td>\n      <td>22835</td>\n      <td>12265</td>\n      <td>30355</td>\n      <td>...</td>\n      <td>28770</td>\n      <td>9492</td>\n      <td>23182</td>\n      <td>28434</td>\n      <td>39543</td>\n      <td>194</td>\n      <td>36397</td>\n      <td>12964</td>\n      <td>16574</td>\n      <td>11744</td>\n    </tr>\n    <tr>\n      <th>27</th>\n      <td>2222</td>\n      <td>23815</td>\n      <td>38339</td>\n      <td>27309</td>\n      <td>30020</td>\n      <td>31174</td>\n      <td>35730</td>\n      <td>35057</td>\n      <td>19810</td>\n      <td>10510</td>\n      <td>...</td>\n      <td>27290</td>\n      <td>23905</td>\n      <td>11245</td>\n      <td>6430</td>\n      <td>6514</td>\n      <td>18320</td>\n      <td>34374</td>\n      <td>9252</td>\n      <td>6737</td>\n      <td>29045</td>\n    </tr>\n    <tr>\n      <th>28</th>\n      <td>9</td>\n      <td>22859</td>\n      <td>35044</td>\n      <td>4627</td>\n      <td>9125</td>\n      <td>19123</td>\n      <td>34735</td>\n      <td>34622</td>\n      <td>31127</td>\n      <td>31910</td>\n      <td>...</td>\n      <td>14507</td>\n      <td>20869</td>\n      <td>3036</td>\n      <td>15560</td>\n      <td>14470</td>\n      <td>30790</td>\n      <td>15428</td>\n      <td>27746</td>\n      <td>5743</td>\n      <td>33981</td>\n    </tr>\n    <tr>\n      <th>29</th>\n      <td>654</td>\n      <td>14069</td>\n      <td>31462</td>\n      <td>2210</td>\n      <td>27827</td>\n      <td>8289</td>\n      <td>1472</td>\n      <td>15549</td>\n      <td>35240</td>\n      <td>34418</td>\n      <td>...</td>\n      <td>12810</td>\n      <td>20898</td>\n      <td>40411</td>\n      <td>29804</td>\n      <td>40351</td>\n      <td>37094</td>\n      <td>38787</td>\n      <td>9968</td>\n      <td>17350</td>\n      <td>14441</td>\n    </tr>\n    <tr>\n      <th>...</th>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n      <td>...</td>\n    </tr>\n    <tr>\n      <th>29828</th>\n      <td>25821</td>\n      <td>23715</td>\n      <td>23164</td>\n      <td>15220</td>\n      <td>38818</td>\n      <td>17232</td>\n      <td>23238</td>\n      <td>27609</td>\n      <td>1023</td>\n      <td>28887</td>\n      <td>...</td>\n      <td>4534</td>\n      <td>40860</td>\n      <td>15170</td>\n      <td>13083</td>\n      <td>6305</td>\n      <td>25038</td>\n      <td>21937</td>\n      <td>33333</td>\n      <td>28694</td>\n      <td>8082</td>\n    </tr>\n    <tr>\n      <th>29829</th>\n      <td>4315</td>\n      <td>15087</td>\n      <td>30482</td>\n      <td>39796</td>\n      <td>30134</td>\n      <td>36508</td>\n      <td>35952</td>\n      <td>25374</td>\n      <td>9543</td>\n      <td>35490</td>\n      <td>...</td>\n      <td>36425</td>\n      <td>16929</td>\n      <td>35910</td>\n      <td>25285</td>\n      <td>38467</td>\n      <td>12836</td>\n      <td>35844</td>\n      <td>407</td>\n      <td>14474</td>\n      <td>32608</td>\n    </tr>\n    <tr>\n      <th>29830</th>\n      <td>31553</td>\n      <td>35060</td>\n      <td>31961</td>\n      <td>18120</td>\n      <td>20739</td>\n      <td>27132</td>\n      <td>38627</td>\n      <td>23108</td>\n      <td>18451</td>\n      <td>28046</td>\n      <td>...</td>\n      <td>25951</td>\n      <td>24318</td>\n      <td>26025</td>\n      <td>35596</td>\n      <td>6668</td>\n      <td>12737</td>\n      <td>34117</td>\n      <td>6603</td>\n      <td>23803</td>\n      <td>10130</td>\n    </tr>\n    <tr>\n      <th>29831</th>\n      <td>34484</td>\n      <td>40804</td>\n      <td>34073</td>\n      <td>36606</td>\n      <td>24265</td>\n      <td>25461</td>\n      <td>37151</td>\n      <td>21321</td>\n      <td>22613</td>\n      <td>9060</td>\n      <td>...</td>\n      <td>19804</td>\n      <td>14787</td>\n      <td>4239</td>\n      <td>18279</td>\n      <td>31815</td>\n      <td>14965</td>\n      <td>36462</td>\n      <td>29628</td>\n      <td>12789</td>\n      <td>27680</td>\n    </tr>\n    <tr>\n      <th>29832</th>\n      <td>14290</td>\n      <td>23508</td>\n      <td>11206</td>\n      <td>2383</td>\n      <td>29674</td>\n      <td>2308</td>\n      <td>27154</td>\n      <td>16181</td>\n      <td>39864</td>\n      <td>18533</td>\n      <td>...</td>\n      <td>29493</td>\n      <td>31172</td>\n      <td>5241</td>\n      <td>11294</td>\n      <td>45</td>\n      <td>16862</td>\n      <td>279</td>\n      <td>4508</td>\n      <td>32708</td>\n      <td>29290</td>\n    </tr>\n    <tr>\n      <th>29833</th>\n      <td>38368</td>\n      <td>39175</td>\n      <td>7875</td>\n      <td>12613</td>\n      <td>23332</td>\n      <td>38676</td>\n      <td>3578</td>\n      <td>40525</td>\n      <td>886</td>\n      <td>40090</td>\n      <td>...</td>\n      <td>29828</td>\n      <td>8446</td>\n      <td>184</td>\n      <td>27384</td>\n      <td>24588</td>\n      <td>2664</td>\n      <td>34223</td>\n      <td>24302</td>\n      <td>25994</td>\n      <td>20992</td>\n    </tr>\n    <tr>\n      <th>29834</th>\n      <td>21873</td>\n      <td>31124</td>\n      <td>26819</td>\n      <td>36443</td>\n      <td>30392</td>\n      <td>22079</td>\n      <td>10622</td>\n      <td>14433</td>\n      <td>5108</td>\n      <td>9918</td>\n      <td>...</td>\n      <td>9256</td>\n      <td>12120</td>\n      <td>3573</td>\n      <td>33951</td>\n      <td>2426</td>\n      <td>22915</td>\n      <td>12335</td>\n      <td>34479</td>\n      <td>36128</td>\n      <td>32547</td>\n    </tr>\n    <tr>\n      <th>29835</th>\n      <td>3121</td>\n      <td>23308</td>\n      <td>34837</td>\n      <td>7076</td>\n      <td>3443</td>\n      <td>430</td>\n      <td>38704</td>\n      <td>12984</td>\n      <td>8524</td>\n      <td>6998</td>\n      <td>...</td>\n      <td>6602</td>\n      <td>40945</td>\n      <td>9610</td>\n      <td>16230</td>\n      <td>27134</td>\n      <td>9907</td>\n      <td>156</td>\n      <td>22975</td>\n      <td>24111</td>\n      <td>4550</td>\n    </tr>\n    <tr>\n      <th>29836</th>\n      <td>37483</td>\n      <td>15036</td>\n      <td>1215</td>\n      <td>35062</td>\n      <td>13899</td>\n      <td>27704</td>\n      <td>6835</td>\n      <td>29500</td>\n      <td>29448</td>\n      <td>30397</td>\n      <td>...</td>\n      <td>16461</td>\n      <td>20672</td>\n      <td>35555</td>\n      <td>40956</td>\n      <td>5068</td>\n      <td>7842</td>\n      <td>12096</td>\n      <td>15479</td>\n      <td>20233</td>\n      <td>10956</td>\n    </tr>\n    <tr>\n      <th>29837</th>\n      <td>8555</td>\n      <td>27998</td>\n      <td>33376</td>\n      <td>34965</td>\n      <td>38471</td>\n      <td>24699</td>\n      <td>7176</td>\n      <td>17960</td>\n      <td>24760</td>\n      <td>38891</td>\n      <td>...</td>\n      <td>22280</td>\n      <td>4040</td>\n      <td>24660</td>\n      <td>5561</td>\n      <td>14475</td>\n      <td>23448</td>\n      <td>446</td>\n      <td>40173</td>\n      <td>28438</td>\n      <td>7237</td>\n    </tr>\n    <tr>\n      <th>29838</th>\n      <td>36129</td>\n      <td>22248</td>\n      <td>2040</td>\n      <td>35857</td>\n      <td>33743</td>\n      <td>10412</td>\n      <td>28886</td>\n      <td>13858</td>\n      <td>7037</td>\n      <td>31387</td>\n      <td>...</td>\n      <td>36863</td>\n      <td>8421</td>\n      <td>20008</td>\n      <td>37275</td>\n      <td>8932</td>\n      <td>32247</td>\n      <td>21752</td>\n      <td>20650</td>\n      <td>30744</td>\n      <td>36204</td>\n    </tr>\n    <tr>\n      <th>29839</th>\n      <td>38445</td>\n      <td>29462</td>\n      <td>31951</td>\n      <td>39360</td>\n      <td>25166</td>\n      <td>38663</td>\n      <td>5368</td>\n      <td>39587</td>\n      <td>30991</td>\n      <td>28800</td>\n      <td>...</td>\n      <td>5497</td>\n      <td>37284</td>\n      <td>470</td>\n      <td>15505</td>\n      <td>32238</td>\n      <td>16766</td>\n      <td>37461</td>\n      <td>36303</td>\n      <td>22101</td>\n      <td>5813</td>\n    </tr>\n    <tr>\n      <th>29840</th>\n      <td>23774</td>\n      <td>39116</td>\n      <td>20038</td>\n      <td>27161</td>\n      <td>23483</td>\n      <td>4034</td>\n      <td>12550</td>\n      <td>22538</td>\n      <td>7223</td>\n      <td>40544</td>\n      <td>...</td>\n      <td>32759</td>\n      <td>28933</td>\n      <td>24065</td>\n      <td>6633</td>\n      <td>17351</td>\n      <td>17485</td>\n      <td>21959</td>\n      <td>8886</td>\n      <td>26012</td>\n      <td>12965</td>\n    </tr>\n    <tr>\n      <th>29841</th>\n      <td>36098</td>\n      <td>13662</td>\n      <td>5105</td>\n      <td>753</td>\n      <td>25783</td>\n      <td>5250</td>\n      <td>33205</td>\n      <td>14031</td>\n      <td>21772</td>\n      <td>6522</td>\n      <td>...</td>\n      <td>33563</td>\n      <td>5288</td>\n      <td>27705</td>\n      <td>5390</td>\n      <td>2363</td>\n      <td>38478</td>\n      <td>6251</td>\n      <td>11134</td>\n      <td>18361</td>\n      <td>13887</td>\n    </tr>\n    <tr>\n      <th>29842</th>\n      <td>35232</td>\n      <td>33734</td>\n      <td>33768</td>\n      <td>17879</td>\n      <td>9840</td>\n      <td>11482</td>\n      <td>14925</td>\n      <td>18851</td>\n      <td>20119</td>\n      <td>3991</td>\n      <td>...</td>\n      <td>5972</td>\n      <td>5081</td>\n      <td>32307</td>\n      <td>3424</td>\n      <td>18588</td>\n      <td>28895</td>\n      <td>18017</td>\n      <td>14345</td>\n      <td>29054</td>\n      <td>3799</td>\n    </tr>\n    <tr>\n      <th>29843</th>\n      <td>18683</td>\n      <td>10228</td>\n      <td>32577</td>\n      <td>36172</td>\n      <td>2318</td>\n      <td>28429</td>\n      <td>9620</td>\n      <td>3099</td>\n      <td>16743</td>\n      <td>7007</td>\n      <td>...</td>\n      <td>15783</td>\n      <td>5743</td>\n      <td>6642</td>\n      <td>36061</td>\n      <td>14483</td>\n      <td>19144</td>\n      <td>38002</td>\n      <td>14011</td>\n      <td>19080</td>\n      <td>11825</td>\n    </tr>\n    <tr>\n      <th>29844</th>\n      <td>6690</td>\n      <td>19844</td>\n      <td>35546</td>\n      <td>20677</td>\n      <td>17458</td>\n      <td>19702</td>\n      <td>19852</td>\n      <td>33103</td>\n      <td>15970</td>\n      <td>16027</td>\n      <td>...</td>\n      <td>19069</td>\n      <td>7001</td>\n      <td>15831</td>\n      <td>20101</td>\n      <td>6894</td>\n      <td>36439</td>\n      <td>11563</td>\n      <td>23378</td>\n      <td>10430</td>\n      <td>1220</td>\n    </tr>\n    <tr>\n      <th>29845</th>\n      <td>20604</td>\n      <td>24669</td>\n      <td>29722</td>\n      <td>18484</td>\n      <td>29403</td>\n      <td>34652</td>\n      <td>7868</td>\n      <td>22588</td>\n      <td>9828</td>\n      <td>34001</td>\n      <td>...</td>\n      <td>40413</td>\n      <td>20636</td>\n      <td>8114</td>\n      <td>27760</td>\n      <td>5010</td>\n      <td>3593</td>\n      <td>9889</td>\n      <td>20393</td>\n      <td>13664</td>\n      <td>32336</td>\n    </tr>\n    <tr>\n      <th>29846</th>\n      <td>2298</td>\n      <td>565</td>\n      <td>16589</td>\n      <td>51</td>\n      <td>32058</td>\n      <td>5165</td>\n      <td>34547</td>\n      <td>2618</td>\n      <td>21370</td>\n      <td>38871</td>\n      <td>...</td>\n      <td>11459</td>\n      <td>4302</td>\n      <td>407</td>\n      <td>18301</td>\n      <td>37672</td>\n      <td>36783</td>\n      <td>555</td>\n      <td>12707</td>\n      <td>12219</td>\n      <td>11613</td>\n    </tr>\n    <tr>\n      <th>29847</th>\n      <td>9400</td>\n      <td>25360</td>\n      <td>39811</td>\n      <td>32234</td>\n      <td>11474</td>\n      <td>22463</td>\n      <td>27138</td>\n      <td>36875</td>\n      <td>10265</td>\n      <td>8097</td>\n      <td>...</td>\n      <td>7699</td>\n      <td>3102</td>\n      <td>40066</td>\n      <td>28917</td>\n      <td>32842</td>\n      <td>24404</td>\n      <td>11421</td>\n      <td>29214</td>\n      <td>37257</td>\n      <td>18229</td>\n    </tr>\n    <tr>\n      <th>29848</th>\n      <td>39744</td>\n      <td>34500</td>\n      <td>9044</td>\n      <td>11187</td>\n      <td>6462</td>\n      <td>6681</td>\n      <td>7090</td>\n      <td>20023</td>\n      <td>36458</td>\n      <td>24541</td>\n      <td>...</td>\n      <td>28041</td>\n      <td>39447</td>\n      <td>20752</td>\n      <td>33542</td>\n      <td>12035</td>\n      <td>28356</td>\n      <td>19288</td>\n      <td>4370</td>\n      <td>19682</td>\n      <td>32779</td>\n    </tr>\n    <tr>\n      <th>29849</th>\n      <td>5741</td>\n      <td>2680</td>\n      <td>13419</td>\n      <td>29824</td>\n      <td>5832</td>\n      <td>37564</td>\n      <td>22952</td>\n      <td>2670</td>\n      <td>8851</td>\n      <td>3844</td>\n      <td>...</td>\n      <td>24195</td>\n      <td>33360</td>\n      <td>11682</td>\n      <td>29587</td>\n      <td>18753</td>\n      <td>30031</td>\n      <td>19408</td>\n      <td>12522</td>\n      <td>26335</td>\n      <td>25458</td>\n    </tr>\n    <tr>\n      <th>29850</th>\n      <td>18529</td>\n      <td>32783</td>\n      <td>40852</td>\n      <td>33559</td>\n      <td>1501</td>\n      <td>11705</td>\n      <td>28961</td>\n      <td>32524</td>\n      <td>22550</td>\n      <td>9919</td>\n      <td>...</td>\n      <td>38279</td>\n      <td>12050</td>\n      <td>21439</td>\n      <td>13947</td>\n      <td>30676</td>\n      <td>3690</td>\n      <td>33283</td>\n      <td>25691</td>\n      <td>10788</td>\n      <td>10172</td>\n    </tr>\n    <tr>\n      <th>29851</th>\n      <td>8049</td>\n      <td>20920</td>\n      <td>3483</td>\n      <td>1645</td>\n      <td>23600</td>\n      <td>11341</td>\n      <td>29504</td>\n      <td>34876</td>\n      <td>35807</td>\n      <td>4809</td>\n      <td>...</td>\n      <td>20096</td>\n      <td>5196</td>\n      <td>9800</td>\n      <td>20110</td>\n      <td>11489</td>\n      <td>19020</td>\n      <td>12623</td>\n      <td>351</td>\n      <td>31987</td>\n      <td>32006</td>\n    </tr>\n    <tr>\n      <th>29852</th>\n      <td>1132</td>\n      <td>36838</td>\n      <td>24664</td>\n      <td>30827</td>\n      <td>36991</td>\n      <td>14290</td>\n      <td>35265</td>\n      <td>9707</td>\n      <td>26246</td>\n      <td>20654</td>\n      <td>...</td>\n      <td>23452</td>\n      <td>17052</td>\n      <td>17261</td>\n      <td>11179</td>\n      <td>33339</td>\n      <td>26310</td>\n      <td>16164</td>\n      <td>33902</td>\n      <td>18603</td>\n      <td>21995</td>\n    </tr>\n    <tr>\n      <th>29853</th>\n      <td>35209</td>\n      <td>443</td>\n      <td>32953</td>\n      <td>19655</td>\n      <td>18922</td>\n      <td>34601</td>\n      <td>31331</td>\n      <td>26159</td>\n      <td>20057</td>\n      <td>13618</td>\n      <td>...</td>\n      <td>28154</td>\n      <td>25344</td>\n      <td>27679</td>\n      <td>22958</td>\n      <td>29303</td>\n      <td>34478</td>\n      <td>25289</td>\n      <td>32604</td>\n      <td>12938</td>\n      <td>11782</td>\n    </tr>\n    <tr>\n      <th>29854</th>\n      <td>14287</td>\n      <td>25957</td>\n      <td>11688</td>\n      <td>28348</td>\n      <td>25774</td>\n      <td>23947</td>\n      <td>25904</td>\n      <td>17430</td>\n      <td>30902</td>\n      <td>7618</td>\n      <td>...</td>\n      <td>7359</td>\n      <td>11699</td>\n      <td>22992</td>\n      <td>5816</td>\n      <td>19070</td>\n      <td>15396</td>\n      <td>35054</td>\n      <td>23274</td>\n      <td>24481</td>\n      <td>1510</td>\n    </tr>\n    <tr>\n      <th>29855</th>\n      <td>38168</td>\n      <td>6004</td>\n      <td>20972</td>\n      <td>38886</td>\n      <td>34281</td>\n      <td>24360</td>\n      <td>33896</td>\n      <td>38994</td>\n      <td>1390</td>\n      <td>17697</td>\n      <td>...</td>\n      <td>15706</td>\n      <td>20215</td>\n      <td>29519</td>\n      <td>26502</td>\n      <td>34223</td>\n      <td>40478</td>\n      <td>10363</td>\n      <td>20292</td>\n      <td>30349</td>\n      <td>25698</td>\n    </tr>\n    <tr>\n      <th>29856</th>\n      <td>33902</td>\n      <td>40154</td>\n      <td>25829</td>\n      <td>27537</td>\n      <td>8644</td>\n      <td>8629</td>\n      <td>10302</td>\n      <td>35634</td>\n      <td>17692</td>\n      <td>6492</td>\n      <td>...</td>\n      <td>34436</td>\n      <td>35606</td>\n      <td>15900</td>\n      <td>14162</td>\n      <td>16570</td>\n      <td>39577</td>\n      <td>40077</td>\n      <td>18069</td>\n      <td>35831</td>\n      <td>15471</td>\n    </tr>\n    <tr>\n      <th>29857</th>\n      <td>26216</td>\n      <td>22928</td>\n      <td>13830</td>\n      <td>28456</td>\n      <td>32645</td>\n      <td>21903</td>\n      <td>38645</td>\n      <td>34268</td>\n      <td>29082</td>\n      <td>34166</td>\n      <td>...</td>\n      <td>18180</td>\n      <td>22897</td>\n      <td>28221</td>\n      <td>29488</td>\n      <td>39285</td>\n      <td>7932</td>\n      <td>16461</td>\n      <td>12189</td>\n      <td>29134</td>\n      <td>7871</td>\n    </tr>\n  </tbody>\n</table>\n<p>29858 rows × 100 columns</p>\n</div>"
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "test_data"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "outputs": [],
   "source": [
    "# save\n",
    "spio.savemat(os.path.join(target_data_path, dataset_name + \"_train.mat\"), {\"train_mat\": train_mat})\n",
    "test_data.to_csv(os.path.join(target_data_path, dataset_name + \"_test.csv\"), index=False)\n",
    "# print(train_mat)\n",
    "# test_data"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "markdown",
   "source": [
    "# 测试"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%% md\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "outputs": [],
   "source": [
    "train_mat_for_test = spio.loadmat(os.path.join(target_data_path, dataset_name + \"_train.mat\"))[\"train_mat\"]\n",
    "test_mat_for_test = pd.read_csv(os.path.join(target_data_path, dataset_name + \"_test.csv\"), names=None)"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 29858/29858 [00:55<00:00, 542.65it/s]\n"
     ]
    }
   ],
   "source": [
    "with tqdm(list(enumerate(test_data[0]))) as temp:\n",
    "    for iid, uid in temp:\n",
    "        assert mat[iid, uid] == 1"
   ],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false,
    "pycharm": {
     "name": "#%%\n"
    }
   }
  }
 ],
 "metadata": {
  "kernelspec": {
   "name": "3070",
   "language": "python",
   "display_name": "3070"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}